
module.exports = ()=>{

    let __handler = null

    if (cc.sys.isNative) 
    {
        if (window['__errorHandler']) 
        {
            handler = window['errorHandler']
        }
        
        window['__errorHandler'] = (...args) =>
        {
            if (__handler) 
            {
                __handler(...args)
            }
        }
    }
    else
    {
        if (cc.sys.isBrowser) 
        {
            if (window.onerror) 
            {
                __handler = window.onerror
            }

            window.onerror = (...args) =>
            {
                if (__handler) 
                {
                    __handler(...args)
                }
            }
        }
    }
}
